﻿<navigation:Page
    xmlns:my1="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Ria"
    xmlns:my="clr-namespace:AdminApp.Web.Services"
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"
    xmlns:AdminApp_Controls="clr-namespace:AdminApp.Controls"
    x:Class="AdminApp.Views.Session"
    d:DesignWidth="805"
    d:DesignHeight="480"
    Title="Session Page">

    <my1:BusyIndicator
        IsBusy="{Binding DomainContext.IsLoading, ElementName=sessionDomainDataSource}">
        <Grid
            x:Name="LayoutRoot">
            <Grid.RowDefinitions>
                <RowDefinition
                    Height="42" />
                <RowDefinition />
                <RowDefinition Height="44"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition
                    Width="400" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <riaControls:DomainDataSource
                AutoLoad="True"
                Height="0"
                LoadedData="sessionDomainDataSource_LoadedData"
                x:Name="sessionDomainDataSource"
                QueryName="GetSessionQuery"
                Width="0"
                Margin="359,11,41,185.5"
                Grid.Row="1">
                <riaControls:DomainDataSource.DomainContext>
                    <my:DigitalSignageDomainContext />
                </riaControls:DomainDataSource.DomainContext>
            </riaControls:DomainDataSource>
            <data:DataGrid
                AutoGenerateColumns="False"
                ItemsSource="{Binding Data, ElementName=sessionDomainDataSource}"
                x:Name="sessionDataGrid"
                RowDetailsVisibilityMode="VisibleWhenSelected"
                Grid.ColumnSpan="1"
                Margin="8" Grid.Row="1" Grid.RowSpan="1">
                <data:DataGrid.Columns>
                    <data:DataGridTextColumn
                        x:Name="titleColumn"
                        Binding="{Binding Title}"
                        Header="Title"
                        Width="300" />
                    <data:DataGridTextColumn
                        x:Name="shortTitleColumn"
                        Binding="{Binding ShortTitle}"
                        Header="ShortTitle"
                        Width="300" />
                    <data:DataGridTextColumn
                        x:Name="abstractColumn"
                        Binding="{Binding Abstract}"
                        Header="Abstract"
                        Width="400" />

                </data:DataGrid.Columns>
            </data:DataGrid>
            <Grid
                DataContext="{Binding SelectedItem, ElementName=sessionDataGrid, Mode=TwoWay}"
                Margin="8"
                x:Name="_detailsGrid" Grid.RowSpan="1" Grid.Column="1" Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition
                        Width="71" />
                    <ColumnDefinition
                        Width="233" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition
                        Height="Auto" />
                    <RowDefinition
                        Height="Auto" />
                    <RowDefinition
                        Height="Auto" />
                </Grid.RowDefinitions>

                <dataInput:Label
                    Content="Title:"
                    Grid.Column="0"
                    Grid.Row="0"
                    HorizontalAlignment="Left"
                    Margin="3"
                    VerticalAlignment="Top" />
                <TextBox
                    Grid.Column="1"
                    Grid.Row="0"
                    Margin="3,3,-77,3"
                    x:Name="titleTextBox"
                    Text="{Binding Title, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />

                <dataInput:Label
                    Content="ShortTitle:"
                    Grid.Column="0"
                    Grid.Row="1"
                    HorizontalAlignment="Left"
                    Margin="3"
                    VerticalAlignment="Top" />
                <TextBox
                    Grid.Column="1"
                    Grid.Row="1"
                    Margin="3,3,-77,3"
                    x:Name="shortTitleTextBox"
                    Text="{Binding ShortTitle, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />


                <dataInput:Label
                    Content="Abstract:"
                    Grid.Column="0"
                    Grid.Row="2"
                    HorizontalAlignment="Left"
                    Margin="3"
                    VerticalAlignment="Center" />
                <TextBox
                    Grid.Column="1"
                    Grid.Row="2"
                    Margin="3,3,-77,-288"
                    x:Name="abstractTextBox"
                    Text="{Binding Abstract, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}"
                    TextWrapping="Wrap" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Auto" AcceptsReturn="True" />
            </Grid>
            <StackPanel
                HorizontalAlignment="Left"
                Margin="8,0,0,8"
                x:Name="_eventPanel"
                Orientation="Horizontal"
                Grid.Row="2" d:LayoutOverrides="Height" VerticalAlignment="Bottom">
                <Button
                    Click="_addNew_Click"
                    Content="New Session"
                    Margin="0"
                    x:Name="_addNew" />
                <Button
                    Click="_delete_Click"
                    Content="Delete Session"
                    Margin="0"
                    x:Name="_delete" />
            </StackPanel>
            <StackPanel
                HorizontalAlignment="Right"
                Margin="0,0,8,8"
                x:Name="_changesPanel"
                Orientation="Horizontal"
                VerticalAlignment="Bottom"
                Grid.Column="1"
                Grid.Row="2"/>

            <AdminApp_Controls:SaveAndRejectControl
                Grid.Column="1"
                Margin="0,1.5,0,0"
                Grid.Row="2"
                DataContext="{Binding ElementName=sessionDomainDataSource}" HorizontalAlignment="Right" d:LayoutOverrides="Height" />
            <AdminApp_Controls:SearchControl Margin="8" SearchTextChanged="SearchControl_SearchTextChanged"/>

        </Grid>
    </my1:BusyIndicator>
</navigation:Page>
